<template>
	<view class="page">
		<z-paging ref="paging" v-model="dataList" @query="queryList">
			<uv-navbar slot="top" autoBack :fixed="true" title="公告中心" placeholder></uv-navbar>

			<!-- 内容 -->
			<view class="content ios">
				<view class="list-item" v-for="(item, idx) in dataList" :key="idx" @click="jump(item.id)">
					<view class="item-time">{{item.created_at}}</view>
					<view class="item-title">{{item.title}}</view>
					<uv-line></uv-line>
					<view class="item-info">
						<view class="info-desc">查看详情</view>
						<uv-icon name="arrow-right" size="12" color="#8d9090"></uv-icon>
					</view>
				</view>
			</view>

			<image slot="empty" class="no-data" src="https://hzybucket.obs.cn-south-1.myhuaweicloud.com/we_chat/no-msg2.png"
				mode="widthFix"></image>
		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		onLoad() {

		},
		methods: {
			jump(id) {
				uni.navigateTo({
					url: '/pages/notice/notice_info?id=' + id
				});
			},
			queryList(page, num) {
				this.getList(page, num);
			},
			getList(page, num) {
				// 获取公告
				this.$Api.wxHomepageData({
					type: 3,
					page: 1,
					num: 10
				}).then((res) => {
					console.log(res, '小程序配置数据-type3');
					if (res.code == 200) {
						this.$refs.paging.complete(res.data.list);
					} else {
						this.$refs.paging.complete([]);
					}
					this.loading = false;
				}).catch((err) => {
					setTimeout(() => {
						// 停止刷新动画
						this.$refs.paging.complete();
						this.loading = false;
					}, 300);
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "list.scss";
</style>